﻿@using Newtouch.Infrastructure
@{
    ViewBag.Title = "SettConfirmForm";
    Layout = "~/Views/Shared/_Form.cshtml";
    //门诊结算可以用预交金
    var withYjj = SysConfigReader.Bool("ChargeWithAdvanceAccount");
    bool? relatedFPH = false;
    if (HttpContext.Current.Request.Params["from"] == "reg")
    {
        //挂号收费
        relatedFPH = SysConfigReader.Bool("Outpatient_RegisterPage_RelatedFPH");
    }
    else
    {
        //记账收费
        relatedFPH = SysConfigReader.Bool("Outpatient_ChargePage_RelatedFPH");
    }
    if (relatedFPH == true)
    {
        //收费票据打印方式
        var invoicePrintMethod = SysConfigReader.String("Outpatient_ChargeFeeInvoice_PrintMethod");
        if (invoicePrintMethod == "ActiveX")
        {
            //以AX打印，这里不生成发票号    //是后更新方式
            relatedFPH = false;
        }
    }
    //医保所属地，区分系统将执行何处医保逻辑
    var medicalInsurance = SysConfigReader.String("Outpatient_MedicalInsurance");
    var sfyxzk = SysConfigReader.Bool("Outpatient_Charge_Open_Zk", false);

    var sfyxdzzf = SysConfigReader.Bool("Outpatient_Charge_Open_Dzzf", false);
    //结算金额分币误差控制
    var SettPayBalance = SysConfigReader.Bool("SettPayBalance", false);
    //是否移动支付
    var needPay = SysConfigReader.Bool("Outpatient_ChargeFee_NeedPay") ?? false;
    //默认支付方式
    var defaultPayMethod = SysConfigReader.String("Sett_PayMethod_Default");
    var opr = Newtouch.Common.Operator.OperatorProvider.GetCurrent();
}
<div id="divYbjyFee" class="panel panel-default" style="display:none;margin-top:10px;margin-left:10px;margin-right: 10px;">
    <div class="panel-heading navb-bg" style="height:20px;">
        费用信息
    </div>
    <div style="height:auto;">
        <table class="form">
            <tr>
                <th class="formTitle">总费用：</th>
                <td class="formValue">￥<label id="ZFY">0.00</label></td>
                <th class="formTitle">一般费用：</th>
                <td class="formValue">￥<label id="YBFY">0.00</label></td>
                <th class="formTitle">特殊费用：</th>
                <td class="formValue">￥<label id="TSFY">0.00</label></td>
                <th class="formTitle">现金支付：</th>
                <td class="formValue">￥<label id="XJZF">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">账户支出：</th>
                <!--JBZF+gbzf -->
                <td class="formValue">￥<label id="YBZHZC">0.00</label></td>
                <th class="formTitle">医保基金支付：</th>
                <!-- ZFY-XJZF-JBZF-GBZF-->
                <td class="formValue">￥<label id="YBJJZF">0.00</label></td>
                <th class="formTitle">门诊自负段累计：</th>
                <td class="formValue">￥<label id="SUMZFDYBFY">0.00</label></td>
                <th class="formTitle">本次门诊自负段：</th>
                <td class="formValue">￥<label id="ZFDYBFY">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">账户余额：</th>
                <!--JBYE+GBYE-->
                <td class="formValue">￥<label id="YBZHYE">0.00</label></td>
                <th class="formTitle">中心报销一般费用：</th>
                <td class="formValue">￥<label id="KBXYBFY">0.00</label></td>
                <th class="formTitle">中心报销特殊费用：</th>
                <td class="formValue">￥<label id="KBXTSFY">0.00</label></td>
            </tr>
        </table>
    </div>
</div>
<!-- shanghaiV5 -->
<div id="divshanghaiv5jyFee" class="panel panel-default" style="display:none;margin-top:10px;margin-left:10px;margin-right: 10px;">
    <div class="panel-heading navb-bg" style="height:20px;">
        费用信息
    </div>
    <div style="height:auto;">
        <table class="form">
            <tr>
                <th class="formTitle">总费用：</th><!--使用-->
                <td class="formValue">￥<label id="ZFY">0.00</label></td>
                <th class="formTitle">医保现金支付：</th>
                <td class="formValue">￥<label id="XJZF">0.00</label></td>
                <th class="formTitle">医保计费：</th><!--使用-->
                <td class="formValue">￥<label id="YBJF">0.00</label></td>

            </tr>
            <tr>
                <th class="formTitle">非医保现金计费：</th><!--无医保代码金额-->
                <td class="formValue">￥<label id="ZFJF">0.00</label></td>
                <th class="formTitle">当年帐户支付数：</th>
                <td class="formValue">￥<label id="curaccountpay">0.00</label></td>
                <th class="formTitle">历年帐户支付数：</th>
                <td class="formValue">￥<label id="hisaccountpay">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">自负段现金支付数：</th>
                <td class="formValue">￥<label id="zfdxjzfs">0.00</label></td>
                <th class="formTitle">自负段历年支付数：</th>
                <td class="formValue">￥<label id="zfdlnzhzfs">0.00</label></td>

                <th class="formTitle">统筹段帐户支付数：</th>
                <td class="formValue">￥<label id="tcdzhzfs">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">统筹段现金支付数：</th>
                <td class="formValue">￥<label id="tcdxjzfs">0.00</label></td>
                <th class="formTitle">统筹支付数：</th>
                <td class="formValue">￥<label id="tczfs">0.00</label></td>
                <th class="formTitle">附加段帐户支付数：</th>
                <td class="formValue">￥<label id="fjdzhzfs">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">附加段现金支付数：</th>
                <td class="formValue">￥<label id="fjdxjzfs">0.00</label></td>
                <th class="formTitle">附加支付数：</th>
                <td class="formValue">￥<label id="fjzfs">0.00</label></td>
                <th class="formTitle">当年帐户余额：</th>
                <td class="formValue">￥<label id="curaccountamt">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">历年帐户余额：</th>
                <td class="formValue">￥<label id="hisaccountamt">0.00</label></td>
                <th class="formTitle">医保结算范围总额：</th>
                <td class="formValue">￥<label id="ybjsfwfyze">0.00</label></td>
                <th class="formTitle">非医保结算范围总额：</th>
                <td class="formValue">￥<label id="fybjsfwfyze">0.00</label></td>

            </tr>
            <tr>
                <th class="formTitle">附加段共济账户支付：</th>
                <td class="formValue">￥<label id="fjdgjzhzfs">0.00</label></td>
                <th class="formTitle">自费段共济账户支付：</th>
                <td class="formValue">￥<label id="zfdgjzhzfs">0.00</label></td>
                <th class="formTitle">共济账户支付：</th>
                <td class="formValue">￥<label id="gjzhzfs">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">统筹段共济账户支付：</th>
                <td class="formValue">￥<label id="tcdgjzhzfs">0.00</label></td>
            </tr>
        </table>
    </div>
</div>

<!-- 新版国家医保展示 -->
<div id="divGjYbFee" class="panel panel-default" style="display:none;margin-top:10px;margin-left:10px;margin-right: 10px;">
    <div class="panel-heading navb-bg" style="height:20px;">
        费用信息
    </div>
    <div style="height:auto;">
        <table class="form">
            <tr>
                <th class="formTitle">总费用：</th><!--使用-->
                <td class="formValue">￥<label id="ZFY">0.00</label></td>
                <th class="formTitle">现金支付：</th>
                <td class="formValue">￥<label id="XJZF">0.00</label></td>
                <th class="formTitle">医保计费：</th><!--使用-->
                <td class="formValue">￥<label id="YBJF">0.00</label></td>

            </tr>
            <tr>
                <th class="formTitle">非医保计费：</th><!--无医保代码金额-->
                <td class="formValue">￥<label id="ZFJF">0.00</label></td>
                <th class="formTitle">统筹支付：</th>
                <td class="formValue">￥<label id="cq_tczf">0.00</label></td>
                <th class="formTitle">公务员补助：</th>
                <td class="formValue">￥<label id="cq_gwybz">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">账户支付：</th>
                <td class="formValue">￥<label id="cq_zhzf">0.00</label></td>
                <th class="formTitle">医院负担金额：</th>
                <td class="formValue">￥<label id="dbzddyljgdz">0.00</label></td>

                <th class="formTitle">大额理赔支付：</th>
                <td class="formValue">￥<label id="cq_delp">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">企业医疗保险支出：</th>
                <td class="formValue">￥<label id="cq_qybxzc">0.00</label></td>
                <th class="formTitle">居民大病支出：</th>
                <td class="formValue">￥<label id="cq_jmdbzc">0.00</label></td>
                <th class="formTitle">医疗救助基金支出：</th>
                <td class="formValue">￥<label id="cq_mzbz">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle">账户共济支付：</th>
                <td class="formValue">￥<label id="cq_zhgjzf">0.00</label></td>
                <th class="formTitle">其他：</th>
                <td class="formValue">￥<label id="cq_qt">0.00</label></td>
            </tr>
        </table>
    </div>
</div>

<div class="panel panel-default" style="margin-top:10px;margin-left:10px;margin-right: 10px;">
    <div class="panel-heading navb-bg" style="height:20px;">
        支付信息
    </div>
    <div style="height:auto;">
        <table class="form" id="tablezf">
            <tr>
                <th class="formTitle"><span style="color:red">*</span>收费日期：</th>
                <td class="formValue">
                    <input id="sfrq" type="text" class="form-control input-wdatepicker formClearIgnore" style="float: left; margin-left: 5px; width:90%" value="@DateTime.Now.ToString(" yyyy-MM-dd")" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" />
                </td>
                <th class="formTitle">费用性质：</th>
                <td class="formValue">
                    <label id="brxzmc"></label>
                </td>
            </tr>
            <tr>
                @if (relatedFPH == true)
                {

                    <th class="formTitle"><span style="color:red">*</span>发票号：</th>
                    <td class="formValue">
                        <label id="txtfph"></label>
                        <div style="position:absolute;top:5px;right:20px;">
                            <input type="button" class="btn btn-default btn-md" style="margin-left:6px;" value="选发票号" onclick="ShowInvoicePanel()" />
                        </div>
                    </td>


                }
            </tr>
            <tr>
                <th class="formTitle" id="tdZqysk">折前应收款：</th>
                <td class="formValue">
                    ￥<label id="zqysk"></label>
                </td>
            </tr>
            <tr id="trYjjzf" style="display:none;">
                <th class="formTitle">预交金余额：</th>
                <td class="formValue">
                    ￥<label id="yjjye"></label>
                </td>
                <td class="formValue" colspan="4">
                    <div class="ckbox ztjsyc">
                        <input id="ckyjjzfuse" type="checkbox"><label for="ckyjjzfuse">预交金支付</label>
                    </div>
                    <div id="dv_yjjtye">
                        <div class="ckbox ztjsyc">
                            <input id="ckyjjzfyeqt" type="checkbox"><label for="ckyjjzfyeqt">余额全退</label>
                        </div>
                        <span style="font-weight:bold;color:red;">可退余额:￥<label id="yeqtje">0.00</label></span>
                    </div>
                </td>
            </tr>
            <tr style="display:none;">
                <th class="formTitle">支付方式：</th>
                <td class="formValue">
                    <select id="zffs1" class="form-control  form-an" style="width:90%">
                        <option value="">==请选择==</option>
                    </select>
                </td>
                <th class="formTitle" style="color:red;">收款：</th>
                <td class="formValue" style="font-size:large">
                    <input type="text" id="zfje1" class="form-control form-an" style="width:90%" />
                </td>
            </tr>
            <tr class="isShowZFFS" style="display:none;">
                <th class="formTitle">第二支付方式：</th>
                <td class="formValue">
                    <select id="zffs2" class="form-control form-an" style="width:90%">
                        <option value="">==可选择==</option>
                    </select>
                </td>
                <th class="formTitle">收款：</th>
                <td class="formValue">
                    <input type="text" id="zfje2" class="form-control form-an" style="width:90%" />
                </td>
            </tr>
            <tr>
                <td colspan="6">
                    <hr />
                </td>
            </tr>
            <tr>
                <th class="formTitle ztjsyc" style="color:red;">预交金抵扣：</th>
                <td class="formValue ztjsyc" style="font-size:large" colspan="2">￥<label id="yjjzfje">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle ztjsyc" style="color:red;">待缴金额：</th>
                <td class="formValue ztjsyc" style="font-size:large" colspan="2">￥<label id="djje">0.00</label></td>
            </tr>
            <tr>
                <th class="formTitle" style="color:red;">
                    <i id="zffsCircle" class="fa fa-plus-circle plusToggleCircle" aria-hidden="true" style="width:30px;margin-left: 10px; color: #6ff3ad; font-size: large;"></i>
                    窗口实收：
                </th>
                <td class="formValue" style="font-size:large" colspan="2">
                    <input type="text" id="djjess" class="form-control required zffsinput" autocomplete="off" onfocus="clearnum()" onkeyup="setzfje('')" onchange="verifyZffs('')" style="width:90%" value="0.00" oninput="inputnum(this)" />
                </td>
                <th class="formTitle">

                    支付方式：
                </th>
                <td class="formValue" colspan="2">
                    <select id="djjesszffs" class="form-control  form-an" style="width:90%">
                        <option value="">==请选择==</option>
                    </select>
                </td>
            </tr>
        </table>
        <table class="form">
            <tr class="trUseZk" style="display:none;">
                <th class="formTitle" style="color:red;">折扣比例：</th>
                <td class="formValue">
                    <input id="zkbl" type="text" class="form-control  form-an" style="width:40%;  float:left;" />
                    <span style="line-height:25px; color:red;">%</span>
                </td>

                <th class="formTitle" style="display:none;">折扣金额：</th>
                <td class="formValue" style="display:none;">
                    <input id="zkje" type="text" class="form-control  form-an" />
                </td>
            </tr>
            <tr style="display:none;">
                <th class="formTitle" style="display:none;">折后应收款：</th>
                <td class="formValue" style="display:none;">
                    ￥<label id="zhysk"></label>
                </td>
            </tr>
            <tr>
                <td colspan="6">
                    <hr />
                </td>
            </tr>
            <tr>
                <th></th>
                <td></td>
                <td></td>
                <th class="formTitle" style="color:red;">合计实收款：</th>
                <td class="formValue" style="font-size:large">￥<label id="hjssk">0.00</label></td>
            </tr>
            <tr>
                <th></th>
                <td colspan="2"></td>
                <th class="formTitle" style="color:red;">找零：</th>
                <td class="formValue" style="font-size:large">￥<label id="zhaoling">0.00</label></td>
            </tr>
            <tr id="tr_yjjtye" hidden>
                <th></th>
                <td colspan="2"></td>
                <th class="formTitle ztjsyc" style="color:red;font-weight:bold;">其中：含预交金退余额</th>
                <td class="formValue ztjsyc" style="font-weight:bold;">（ ￥<label id="yjjtye">0.00</label> ）</td>
            </tr>
        </table>
    </div>
</div>
<script>
    //预交金余额
    var yjjye = 0;
    var withYjj = '@(withYjj)';
    var sfyxzk = '@(sfyxzk)';
    var sfyxdzzf = '@(sfyxdzzf)';
    var SettPayBalance='@(SettPayBalance)';
    var medicalInsurance = '@medicalInsurance';
    var defaultPayMethod = "@(defaultPayMethod)";
    //结算总金额
    var zje = ovpraseFloat($.request("zje"));
    //支付应收 结算时应收（zje = 可报 + 结算时应收 + 等等）
    var orglxjzfys = ovpraseFloat($.request("xjzfys"));
    //有折扣时不等 original
    var xjzfys = orglxjzfys;    //有折扣时会不等
    //医保相关
    var ybjyFeeReturn = JSON.parse(sessionStorage.getItem('ybjyFeeReturn'));
    var isYbjy = $.request("isYbjy");
    var isXnh = $.request("isXnh") === "1" ? true : false;
    var brxz = $.request("brxz");
    var brxzmc = $.request("brxzmc");
    var isjm = $.request("isjm");
    var strdyjylsh = "";
    var cqPatInfo = JSON.parse(sessionStorage.getItem('cqPatInfo'));
	var zhdyList = "";
	var postdata = { comport: 1, context: "", typemc: "" };
    $('#brxzmc').html(brxzmc);
    if (isYbjy === 'true' || isXnh) {debugger;
        $('#tdZqysk').html('应收款：');
        //新版国家医保
        if (cqPatInfo.ybVer === "gjyb") {
		var ybzje = 0.000;//医保的总金额
		var xjzfje = 0.000;//医保的现金支付金额
        var zhzf = 0.000;//账户支付
        var tczf = 0.000;
        var mzjzje = 0.000;//民政救助金额
        if (!!ybjyFeeReturn) {
            mzjzje = ovpraseFloat(ybjyFeeReturn.maf_pay);
            tczf = ovpraseFloat(ybjyFeeReturn.hifp_pay);
            //tczf = (tczf - mzjzje).toFixed(2);
			//医保的现金支付金额
            xjzfje = ovpraseFloat(ybjyFeeReturn.psn_cash_pay);
			//账户支付
            zhzf = ovpraseFloat(ybjyFeeReturn.acct_pay);
			//医保的总金额
			ybzje = ovpraseFloat(ybjyFeeReturn.ybzje);

			xjzfys = zje - ybzje + xjzfje;
			xjzfys = ovpraseFloat(xjzfys).toFixed(2);
			orglxjzfys = xjzfys;
			mzjzje = (mzjzje).toFixed(2);
        } else {
			//异常
			orglxjzfys = xjzfys = zje = 0;
			$.modalAlert("医保支付异常，请重试", "error");
			$.modalClose();
		}
		$('#divYbjyFee').remove();
		$('#divshanghaiv5jyFee').remove();
		$('#divGjYbFee').show();
		$('#ZFY').html(zje);//总费用
		$('#XJZF').html((ovpraseFloat(xjzfje)).toFixed(2));//医保现金支付
		$('#ZFJF').html((ovpraseFloat(zje) - ovpraseFloat(ybzje)).toFixed(2));//自费计费
		$('#YBJF').html(ybzje);
		!!ybjyFeeReturn.acct_pay && $('#cq_zhzf').html(ovpraseFloat(ybjyFeeReturn.acct_pay).toFixed(2));
		!!ybjyFeeReturn.hifp_pay && $('#cq_tczf').html((ovpraseFloat(ybjyFeeReturn.hifp_pay)));
		!!ybjyFeeReturn.hifob_pay && $('#cq_delp').html(ovpraseFloat(ybjyFeeReturn.hifob_pay).toFixed(2));
		!!ybjyFeeReturn.cvlserv_pay && $('#cq_gwybz').html(ovpraseFloat(ybjyFeeReturn.cvlserv_pay).toFixed(2));
		!!ybjyFeeReturn.maf_pay && $('#cq_mzbz').html(mzjzje);

		!!ybjyFeeReturn.hosp_part_amt && $('#dbzddyljgdz').html((ovpraseFloat(ybjyFeeReturn.hosp_part_amt)));

		!!ybjyFeeReturn.hifes_pay && $('#cq_qybxzc').html(ovpraseFloat(ybjyFeeReturn.hifes_pay).toFixed(2));
		!!ybjyFeeReturn.hifmi_pay && $('#cq_jmdbzc').html(ovpraseFloat(ybjyFeeReturn.hifmi_pay).toFixed(2));
		!!ybjyFeeReturn.oth_pay && $('#cq_qt').html(ovpraseFloat(ybjyFeeReturn.oth_pay).toFixed(2));
		!!ybjyFeeReturn.acct_mulaid_pay && $('#cq_zhgjzf').html(ovpraseFloat(ybjyFeeReturn.acct_mulaid_pay).toFixed(2));
        }
        else if (cqPatInfo.ybVer === "shanghaiV5"){
            var ybzje = 0.000;//医保的总金额
            var xjzfje = 0.000;//医保的现金支付金额
            if (!!ybjyFeeReturn) {
                //医保的现金支付金额
                xjzfje = ovpraseFloat(ybjyFeeReturn.zfdxjzfs)+ovpraseFloat(ybjyFeeReturn.tcdxjzfs)
                    +ovpraseFloat(ybjyFeeReturn.fjdxjzfs)+ovpraseFloat(ybjyFeeReturn.zfdgjzhzfs);
                //医保的总金额
                ybzje = ovpraseFloat(ybjyFeeReturn.ybjsfwfyze);

                xjzfys = zje - ybzje + xjzfje;
                xjzfys = ovpraseFloat(xjzfys).toFixed(2);
                orglxjzfys = xjzfys;
            } else {
                //异常
                orglxjzfys = xjzfys = zje = 0;
                $.modalAlert("医保支付异常，请重试", "error");
                $.modalClose();
            }
            $('#divYbjyFee').remove();
            $('#divshanghaiv5jyFee').show();
            $('#divGjYbFee').remove();
            $('#ZFY').html(zje);//总费用
            $('#XJZF').html((ovpraseFloat(xjzfje)).toFixed(2));//医保现金支付
            //$('#ZFJF').html((ovpraseFloat(zje) - ovpraseFloat(ybzje)).toFixed(2));//自费计费
            $('#ZFJF').html(ovpraseFloat(ybjyFeeReturn.fybjsfwfyze).toFixed(2));//非医保自费计费
            $('#YBJF').html(ybzje);

            !!ybjyFeeReturn.curaccountpay && $('#curaccountpay').html(ovpraseFloat(ybjyFeeReturn.curaccountpay).toFixed(2));
            !!ybjyFeeReturn.hisaccountpay && $('#hisaccountpay').html(ovpraseFloat(ybjyFeeReturn.hisaccountpay).toFixed(2));
            !!ybjyFeeReturn.zfdxjzfs && $('#zfdxjzfs').html(ovpraseFloat(ybjyFeeReturn.zfdxjzfs).toFixed(2));
            !!ybjyFeeReturn.zfdlnzhzfs && $('#zfdlnzhzfs').html(ovpraseFloat(ybjyFeeReturn.zfdlnzhzfs).toFixed(2));

            !!ybjyFeeReturn.tcdzhzfs && $('#tcdzhzfs').html(ovpraseFloat(ybjyFeeReturn.tcdzhzfs).toFixed(2));
            !!ybjyFeeReturn.tcdxjzfs && $('#tcdxjzfs').html((ovpraseFloat(ybjyFeeReturn.tcdxjzfs)));
            !!ybjyFeeReturn.tczfs && $('#tczfs').html(ovpraseFloat(ybjyFeeReturn.tczfs).toFixed(2));
            !!ybjyFeeReturn.fjdzhzfs && $('#fjdzhzfs').html(ovpraseFloat(ybjyFeeReturn.fjdzhzfs).toFixed(2));
            !!ybjyFeeReturn.fjdxjzfs && $('#fjdxjzfs').html(ovpraseFloat(ybjyFeeReturn.fjdxjzfs).toFixed(2));

            !!ybjyFeeReturn.fjzfs && $('#fjzfs').html(ovpraseFloat(ybjyFeeReturn.fjzfs).toFixed(2));

            !!ybjyFeeReturn.curaccountamt && $('#curaccountamt').html(ovpraseFloat(ybjyFeeReturn.curaccountamt).toFixed(2));
            !!ybjyFeeReturn.hisaccountamt && $('#hisaccountamt').html(ovpraseFloat(ybjyFeeReturn.hisaccountamt).toFixed(2));
            !!ybjyFeeReturn.ybjsfwfyze && $('#ybjsfwfyze').html(ovpraseFloat(ybjyFeeReturn.ybjsfwfyze).toFixed(2));
            !!ybjyFeeReturn.fybjsfwfyze && $('#fybjsfwfyze').html(ovpraseFloat(ybjyFeeReturn.fybjsfwfyze).toFixed(2));
            //共济账户
            !!ybjyFeeReturn.fjdgjzhzfs && $('#fjdgjzhzfs').html(ovpraseFloat(ybjyFeeReturn.fjdgjzhzfs).toFixed(2));
            !!ybjyFeeReturn.zfdgjzhzfs && $('#zfdgjzhzfs').html(ovpraseFloat(ybjyFeeReturn.zfdgjzhzfs).toFixed(2));
            !!ybjyFeeReturn.gjzhzfs && $('#gjzhzfs').html(ovpraseFloat(ybjyFeeReturn.gjzhzfs).toFixed(2));
            !!ybjyFeeReturn.tcdgjzhzfs && $('#tcdgjzhzfs').html(ovpraseFloat(ybjyFeeReturn.tcdgjzhzfs).toFixed(2));
        }
    } else {
    	if (medicalInsurance === "guian" || medicalInsurance === "chongqing") {
            $('#tdZqysk').html('应收款：');
        }
    }
    //
    //if (!(isYbjy === 'true' | isXnh)) {
    //    if (sfyxzk === 'true') {
    //        //可以用折扣
    //        $('.trUseZk').show();
    //    } else {

    //        $(".trUseZk").hide();
    //    }

    //}
    if (sfyxdzzf===true) {
    if (brxz == 0 || brxzmc=="自费") {
        $('.trUseZk').show();
    } else {
        $(".trUseZk").hide();
        }
    }
    function ovpraseFloat(val) {
        if (!val) {
            val = 0;
        }
        return parseFloat(val);
    }
    $(function () {
        if (isjm=="true") {
            xjzfys = 0;
        }
        if (!!xjzfys || xjzfys === 0) {
            $('#zqysk').html(ovpraseFloat(xjzfys).toFixed(2));
            $('#zfje1').val(ovpraseFloat(xjzfys).toFixed(2));
            //$('#zhysk').html(ovpraseFloat(xjzfys).toFixed(2));
            if (!(defaultPayMethod == '0')) {
                $('#zfje1').val(ovpraseFloat(xjzfys).toFixed(2));
            }
            $('#hjssk').html(ovpraseFloat(xjzfys).toFixed(2));
            $('#zhaoling').html('0.00');
        }

        if (withYjj === 'True') {
            $.najax({
                url: "/PatientManage/AccountManage/GetZhyeByPatid?patid=" + $.request("patid") +"&zhxz="+@((int)EnumXTZHXZ.MZYJKZH),
                cache: false,
                async: false,
                alertbierror: false,
                success: function (zhyeData) {
                    if (zhyeData && zhyeData.data) {
                        yjjye = zhyeData.data;
                    }
                }
            });
        }
        debugger;
        if (yjjye) {
            $('#trYjjzf').show();
            $('#yjjye').html(ovpraseFloat(yjjye).toFixed(2));
			if (ovpraseFloat(yjjye) > 0) {
				$('#ckyjjzfuse').attr("checked", "checked");
			}
			yjjReset();
		} else {
			$('#yjjzfje').html(ovpraseFloat(0).toFixed(2));
			hjsskZhaolingCalNew();

		}
		postdata.context = $("#djje").html();
		postdata.typemc = "J";
		BJQYY(postdata, true);//付款

		//取消预交金支付时 同时取消余额全退
		$("#ckyjjzfuse").click(function () {
			if ($('#ckyjjzfuse').is(':checked')) {
				if ($('#ckyjjzfyeqt').is(':checked')) {
					$("#ckyjjzfyeqt").trigger('click');
				}
				else {
					yjjReset();
				}
			}
			else {
				if ($('#ckyjjzfyeqt').is(':checked')) {
					$('#ckyjjzfyeqt').trigger('click');
				}
				$('#yjjzfje').html(ovpraseFloat(0).toFixed(2));
				hjsskZhaolingCalNew();
			}
		});

		$("#ckyjjzfyeqt").click(function () {
			if ($('#ckyjjzfyeqt').is(':checked')) {
				if (!($('#ckyjjzfuse').is(':checked'))) {
					$("#ckyjjzfuse").trigger('click');
				}
				$("#tr_yjjtye").show();
				//预交金支付方式，‘余额全退’
				if (!!yjjye && yjjye >= xjzfys) {
					$('#yeqtje').html((yjjye - xjzfys).toFixed(2));
					$('#yjjtye').html((yjjye - xjzfys).toFixed(2));
					$('#yjjzfje').html(ovpraseFloat(xjzfys).toFixed(2));
					hjsskZhaolingCalNew();
				}
				else if (!!yjjye) {
					$('#yjjzfje').html(ovpraseFloat(yjjye).toFixed(2));
					hjsskZhaolingCalNew();
				}
			}
			else {
				$("#tr_yjjtye").hide();
				$('#yjjtye').html(ovpraseFloat(0).toFixed(2));
				hjsskZhaolingCalNew();
			}
		});

		//现场窗口缴费支付方式-except预交金
		$("#djjesszffs").newtouchBindSelect({
			datasource: function () {
				var resultObjArr = new Array();
				$.each(top.clients.SysForCashPayList, function (key, value) {
					if (value.xjzffs == '3') {
						return; //不显示该支付方式
					}
					if (value.xjzffs == "0") {
						$('#djjesszffs').append('<option value="' + value.xjzffs + '" selected >' + value.xjzffsmc + '</option>');

					}
					else {
						$('#djjesszffs').append('<option value="' + value.xjzffs + '">' + value.xjzffsmc + '</option>');
					}
				});
				return resultObjArr;
			}
		});

        initFPH();
        initPage();
        $("#djjess").focus();
    });
    $("#cardType").click(function() {
        if ($("#cardType").prop("checked")) {
            $("#zhdy").removeAttr("disabled");
        } else {
            $("#zhdy").attr("disabled", "disabled");
        }
    })

    function initPage() {
        if (sfyxzk===false) {
            $(".trUseZk").hide();
        }
        if (sfyxdzzf===true) {
            $(".isShowZFFS").show();
        }
    }

    var theAcceptClickCallBack = null;
    function AcceptClick(callBack) {

        theAcceptClickCallBack = callBack;


		postdata.context = $("#djjess").val();
		postdata.typemc = "Y";
		BJQYY(postdata, true);//收款
		postdata.context = $("#zhaoling").val();
		postdata.typemc = "Z";
        BJQYY(postdata, true);//找零
		if (zhaoling > 0) {
            postdata.typemc = "D";
			BJQYY(postdata, true);//找零当面点清
		}
        //填写的收费日期 等
        var obj = getPostData();
        if (obj) {
            //190328add移动支付
            if (!CheckPayOK(obj)) {
                return;
            }
            //
            callBack(obj, outTradeNo);
        }
    }

    function getPostData() {
        debugger;
        var sfrq = $('#sfrq').val();
        var fph = $('#txtfph').html();

        var zkje = $('#zkje').val();
        zkje = !!ovpraseFloat(zkje) ? ovpraseFloat(zkje) : 0;
        var zkbl = $('#zkbl').val();
        zkbl = !!parseInt(zkbl) ? (parseInt(zkbl) / 100).toFixed(2) : 0;
        var hjssk = $('#hjssk').html();
        hjssk = !!ovpraseFloat(hjssk) ? ovpraseFloat(hjssk) : 0;
        var zhaoling = $('#zhaoling').html();
        zhaoling = !!ovpraseFloat(zhaoling) ? ovpraseFloat(zhaoling) : 0;
        //
        if (!!!sfrq) {
            $.modalAlert('缺少收费日期', 'warning');
            return false;
        }
        if ($.getDate() < sfrq) {
            $.modalAlert('收费日期错误', 'warning');
            return false;
        }
        //
        if ($('#txtfph').length == 0) {
            fph = null;
        }
        else {
            if (!fph) {
                $.modalAlert('请选择发票号', 'warning');
                return false;
            }
        }
        var yjjtye = $('#yjjtye').text();
		var djjess = $('#djjess').val();
		var fph = $('#txtfph').html();
		var djjesszffs = $('#djjesszffs option:selected').val();
		var djjess = $('#djjess').val();
		if (djjesszffs == "" && ovpraseFloat(djjess) > 0) {
			$.modalAlert('请选择支付方式', 'error');
			return false;    //支付方式选择错误
		}
		else if (ovpraseFloat(djjess) < 0) {
			$.modalAlert('窗口实收金额异常', 'error');
			return false;
		}
        var yjjzfje = $("#yjjzfje").text().trim();
        if (isjm!="true") {
            if ((ovpraseFloat(hjssk) + ovpraseFloat(yjjtye)).toFixed(2) != $.addNum(xjzfys, zhaoling).toFixed(2) || zhaoling < 0) {
                $.modalAlert("找零金额异常", "error");
                return false;
            }
        }
        var PatZfList=getzfArrayData();
        var xjwc=(ovpraseFloat($("#zqysk").html())-ovpraseFloat($("#djje").html())).toFixed(2);
        return {
            sfrq: sfrq, fph: fph
            , zje: ovpraseFloat(zje).toFixed(2), orglxjzfys: orglxjzfys, zkje: zkje, zkbl: zkbl, xjzfys: ovpraseFloat(xjzfys).toFixed(2)
            , ssk: hjssk, zhaoling: zhaoling, dyjylsh: strdyjylsh
			, yjjzfje: ovpraseFloat(yjjzfje).toFixed(2), yjjtye: ovpraseFloat(yjjtye).toFixed(2)
            , PatZfList:PatZfList,xjwc:xjwc
			, djjesszffs: djjesszffs, djjess: ovpraseFloat(djjess).toFixed(2)
        };
    }

    function getzfArrayData()
    {
        var PatZfList = [];
        var PatZfObj = {
            zfje:  $('#djjess').val(),
            zffsmc:  $('#djjesszffs option:selected').val()
        }
        PatZfList.push(PatZfObj);
        var number = $('#tablezf .zffsinput').length;
        for (var i = 1; i <= number-1; i++) {
            PatZfObj = {
                zfje:ovpraseFloat($("#djjess" + i).val()).toFixed(2),
                zffsmc:$("#djjesszffs"+i+" option:selected").val()
            }
            PatZfList.push(PatZfObj);
        }
        return PatZfList;
    }

     //预交金支付
    function yjjReset() {
        debugger;
        if(SettPayBalance==="True")
            xjzfys=ovpraseFloat(xjzfys).toFixed(1);
        $("#djjess").val(ovpraseFloat(0).toFixed(2));
        if (ovpraseFloat(yjjye) > xjzfys) {
            $("#dv_yjjtye").show();
            $("#yeqtje").html(ovpraseFloat(yjjye - xjzfys).toFixed(2));
            $('#yjjzfje').html(ovpraseFloat(xjzfys).toFixed(2));
        }
        else {
            $('#yjjzfje').html(ovpraseFloat(yjjye).toFixed(2));
            $("#dv_yjjtye").hide();
        }
        if ('@defaultPayMethod' == "1" && !ztjs) {
            $('#ckyjjzfyeqt').attr("checked", "checked").attr("disabled", "disabled");
        }

        hjsskZhaolingCalNew();
    }

    function hjsskZhaolingCalNew() {
        var yjjzf = ovpraseFloat($("#yjjzfje").text().trim()).toFixed(2);//预交金抵扣
        var djje = 0.00; //代缴金额
        //var djjess = ovpraseFloat($("#djjess").val());  //窗口实收
        var djjess=CalculatedAmount();//窗口实收合计
        var zhaoling = 0.00;
        var hjssk = 0.00;
        //var zhysk = ovpraseFloat($("#zhysk").val());  //折扣后预收
        var yjjtye = ovpraseFloat($("#yjjtye").text().trim()).toFixed(2);
        if (!!yjjzf && ovpraseFloat(yjjzf)>=0) {
            if(SettPayBalance==="True")
                xjzfys=ovpraseFloat(xjzfys).toFixed(1);
            djje = (ovpraseFloat(xjzfys) - ovpraseFloat(yjjzf)).toFixed(2);
            if (ovpraseFloat(djje) < 0) {
                //djje = 0.00;
				$("#djje").html(ovpraseFloat(0).toFixed(2));
				if (djjess<=0) {
					$("#djjess").val(ovpraseFloat(djje).toFixed(2));
					djjess = ovpraseFloat($("#djjess").val());
				}

                $('#hjssk').html((ovpraseFloat(yjjzf) + ovpraseFloat(djjess)).toFixed(2));
                zhaoling = (Math.abs(ovpraseFloat(djje)) + djjess + ovpraseFloat(yjjtye)).toFixed(2);
                $('#zhaoling').html(zhaoling);
            }
            else {
				$("#djje").html(ovpraseFloat(djje).toFixed(2));
				if (djjess <= 0) {
					$("#djjess").val(ovpraseFloat(djje).toFixed(2));
					djjess = ovpraseFloat($("#djjess").val());
				}

                hjssk = (ovpraseFloat(yjjzf) + ovpraseFloat(djjess)).toFixed(2);
                $('#hjssk').html(hjssk);
                zhaoling = (ovpraseFloat(hjssk) - ovpraseFloat(xjzfys) + ovpraseFloat(yjjtye)).toFixed(2);
                $('#zhaoling').html(zhaoling);
            }
        }
    }
    //多支付方式金额合计
    function CalculatedAmount()
    {
        var cksshj=ovpraseFloat($("#djjess").val());
        var number = $('#tablezf .zffsinput').length;
        for (var i = 1; i <= number-1; i++){
            cksshj=cksshj+ovpraseFloat($("#djjess"+i).val());
        }
        return cksshj.toFixed(2);
    }
    //common start

    //页面进来，加载发票号
    function initFPH() {
        if (!($("#txtfph").length == 1)) {
            return;
        }
        $.najax({
            url: "/OutpatientManage/OutpatientReg/GetInvoice?r=" + Math.random(),
            dataType: "text",
            cache: false,
            success: function (data) {
                $("#txtfph").html(data);
            }
        });
    }

    //弹出发票号的窗口
    function ShowInvoicePanel() {
        $.modalOpen({
            id: "InvoiceNoPanel",
            title: "选发票号",
            url: "/OutpatientManage/OutpatientReg/ChooseInvoice?from=ConfirmFeeForm",
            width: "300px",
            height: "200px",
            callBack: function (iframeId) {
                top.frames[iframeId].checkFPH();//窗口点确定的回调函数
            }
        });
    }

    //
    $('#zfje1').keyup(function () {
        hjsskZhaolingCalNew();
        //hjsskZhaolingCal();
        //if ($('#ckyjjzfyeqt').is(':checked')) {
        //    $('#ckyjjzfyeqt').trigger('click');
        //}
    });
	$('#zfje1').change(function () {
        hjsskZhaolingCalNew();
		if ($("#djjesszffs option:selected").val() == "" && ovpraseFloat($("#djjess").val()) != 0) {
			$.modalAlert('请选择支付方式', 'error');
		}
        //hjsskZhaolingCal();
        //if ($('#ckyjjzfyeqt').is(':checked')) {
        //    $('#ckyjjzfyeqt').trigger('click');
        //}
    });

    //计算 根据 支付应收、支付方式 计算合计实收款、找零
    function hjsskZhaolingCal() {
        if (!$('#zffs1').val() && $('#zfje1').val() != 0) {
            //未选择支付方式，对应金额要置为0.00
            $('#zfje1').val('0.00');
        }
        var zfje1 = $('#zfje1').val();
        if (!zfje1) {
            zfje1 = '0.00';
        }
        if (!$('#zffs2').val() && $('#zfje2').val() != 0) {
            //未选择支付方式，对应金额要置为0.00
            $('#zfje2').val('0.00');
        }
        var zfje2 = $('#zfje2').val();
        if (!zfje2) {
            zfje2 = '0.00';
        }
        var hjssk = ovpraseFloat(zfje1) + ovpraseFloat(zfje2);  //多种支付方式合计实收
        $('#hjssk').html(ovpraseFloat(hjssk).toFixed(2));
        $('#zhaoling').html(ovpraseFloat(hjssk - xjzfys).toFixed(2));
    }

    //如果有折扣功能start

    //
    $('#zkje,#zkbl').keyup(function () {
        discountCal();
    });

    //折扣比例，折扣金额 计算折扣
    function discountCal() {
        var zkje = $('#zkje').val();
        var zkbl = $('#zkbl').val();
        var je = calZkhMoney(ovpraseFloat(orglxjzfys).toFixed(2), zkje, zkbl);
        if (je === false) {
            //折扣计算失败 只能重置折扣
            $('#zkje').val('');
            $('#zkbl').val('');
            xjzfys = orglxjzfys;
        }
        else {
            xjzfys = je;
        }
        //
        //$('#zhysk').html(xjzfys);
        if ($('#ckyjjzfuse').is(':checked')) {
            $('#yjjzfje').text(xjzfys);
            $('#yeqtje').html((yjjye - xjzfys).toFixed(2));
        }

        //$('#zfje1').val(xjzfys);
        //
        //$('#zfje2').val('').trigger('change');
        //
        //if ($('#ckyjjzfyeqt').is(':checked')) {
        //    $('#ckyjjzfyeqt').trigger('click');
        //}
        //
        //hjsskZhaolingCal();
        hjsskZhaolingCalNew();
    }

    //根据折扣比例和折扣金额计算 折后金额
    function calZkhMoney(je, zkje, zkbl) {
        if (je == 0) {
            return 0;
        }
        if (validMoney(je, zkje, zkbl)) {
            if (zkbl) {
                //折扣比例
                var decimalbl = ( parseInt(zkbl) / 100).toFixed(2);
                je = roundingBy4she6ru5chengshuang(ovpraseFloat(ovpraseFloat(je) * decimalbl), 2);
            }
            if (zkje) {
                if (ovpraseFloat(zkje) > ovpraseFloat(je)) {
                    $.modalAlert('折扣异常，产生负应收', 'warning');
                    return false;
                }
                //折扣金额
                je = roundingBy4she6ru5chengshuang(ovpraseFloat((ovpraseFloat(je) - ovpraseFloat(zkje))), 2);
            }
            return ovpraseFloat(je);
        }
        else {
            return false;
        }
    }

    //验证金额格式是否正确
    function validMoney(zqje, zkje, zkbl) {
        if (zqje == '' || zqje == '0.00') {
            $.modalAlert('费用无效', 'warning');
            return false;
        }
        //折扣金额
        var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
        if (!!zkje) {
            if (!reg.test(zkje) || zkje == '') {
                $.modalAlert('折扣金额格式有误', 'warning');
                return false;
            }
        }

        if (ovpraseFloat(zkje) > ovpraseFloat(zqje)) {
            $.modalAlert('折扣金额不能大于折前金额', 'warning');
            return false;
        }

        //折扣比例
        var blreg = /(^[1-9][0-9]$)|(^100&)|(^[1-9]$)$/;
        if (!!zkbl) {
            if (!reg.test(zkbl)) {
                $.modalAlert('折扣比例格式有误', 'warning');
                return false;
            }
        }
        if (parseInt(zkbl) > 100) {
            $.modalAlert('折扣比例不能大于100', 'warning');
            return false;
        }
        return true;
    }

    //如果有折扣功能end

    //common end
</script>
<script type="text/javascript">
    //移动支付
    var payingOrFailed = null;  //true支付中或支付失败
    function CheckPayOK(settInfo) {
        //&&需要支付
        var needPay = '@(needPay)' == 'True';
        if (!needPay) {
            return true;
        }
        var payMoney = 0;
        var alipayMoney = 0;
        var wechatMoney = 0;
        if (settInfo.zfje1 > 0) {
            if (settInfo.zffs1 == '10') {
                alipayMoney = settInfo.zfje1;
            }
            else if (settInfo.zffs1 == '11') {
                wechatMoney = settInfo.zfje1;
            }
        }
        if (settInfo.zfje2 > 0) {
            if (settInfo.zffs2 == '10') {
                alipayMoney = settInfo.zfje2;
            }
            else if (settInfo.zffs2 == '11') {
                wechatMoney = settInfo.zfje2;
            }
        }
        if (alipayMoney > 0 && wechatMoney > 0) {
            $.modalAlert('支付方式选择错误', 'error');
            return false;    //支付方式选择错误
        }
        payMoney = alipayMoney + wechatMoney;
        if (payMoney <= 0) {
            //不需要移动支付
            payingOrFailed = null;
            return true;
        }
        if (payMoney > 0 && !!settInfo.zffs1 && !!settInfo.zffs2) {
            $.modalAlert('移动支付<br/>不支持选择多种支付方式', 'error');
            return false;    //支付方式选择错误
        }
        if (payMoney > 0 && settInfo.zhaoling != 0) {
            $.modalAlert('移动支付不能有找零', 'error');
            return false;
        }
        if ((payingOrFailed === null || payingOrFailed === true) && needPay && payMoney > 0) {
            payMoney = ovpraseFloat(payMoney).toFixed(2);
            var out_trade_no = (new Date()).getTime().toString();   //是否有问题？
            ToPay(out_trade_no, '门诊收费', payMoney);
            payingOrFailed = true;
        }
        return !(payingOrFailed === true); //支付中 返回true，否则返回false
    }
    //发起支付
    function ToPay(out_trade_no, subject, total_amount) {
        var title = '付款码支付-' + (subject.length <= 15 ? subject : subject.substring(0, 12) + "...");
        var url = "/PayManage/MicroPay/MicroPay";
        url += '?out_trade_no=' + out_trade_no;
        url += '&subject=' + subject;
        url += '&total_amount=' + total_amount;
        $.modalOpen({
            id: "ToPay",
            title: title,
            url: url,
            width: "400px",
            height: "210px",
            callBack: function (iframeId) {
                top.frames[iframeId].AcceptClick(function (data) {
                    //pay success callback
                    PaySuccessHandle(data);
                });
            }
        });
    }
    //支付成功-继续提交结算
    var outTradeNo;
    function PaySuccessHandle(data) {
        payingOrFailed = false;

        outTradeNo = data.outTradeNo;
        //移动支付方式纠正
        if (data.payType == 1 && $('#zffs1').val() == '11') {
            $('#zffs1').val("10").trigger('change');
        }
        if (data.payType == 2 && $('#zffs1').val() == '10') {
            $('#zffs1').val("11").trigger('change');
        }
        AcceptClick(theAcceptClickCallBack);
    }
	//输入框控制
    function inputnum(obj, val) {

		obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
		obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
		obj.value = obj.value.replace(/\.{2,}/g, ""); //只保留第一个, 清除多余的
		obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
		obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
    }
    ///////////多种支付方式////////////////
    function clearnum(num) {
        if(!num)
            num="";
        $('#djjess'+num).select();
    }

    //多种支付方式
    $('#tablezf .plusToggleCircle').click(function (){
        debugger;
        var isAdd=verifyZfje();
        if(isAdd==false)
        {
            $.modalAlert("当前窗口实收合计大于等于待缴金额，不可添加新支付方式", 'error');
            return;
        }
        var vcn = 0;
        $.each(top.clients.SysForCashPayList, function (key, value) {
            if (value.xjzffs != '3') {
                vcn ++;
            }
        });
        var number = $('#tablezf .zffsinput').length;
        if (number >= vcn) {
            return;
        }
        var $newTr= $('<tr><th class="formTitle" style="color:red;"><i class="fa fa-minus minusToggleCircle" aria-hidden="true"  name="idjjess' + number + '" style="width:30px;margin-left: 10px; color: #6ff3ad; font-size: large;"></i>窗口实收： </th><td class="formValue" style="font-size:large" colspan="2"> <input type="text" id="djjess' + number + '" name="djjess' + number + '" class="form-control required zffsinput" autocomplete="off" onkeyup="setzfje(' + number + ')" onfocus="clearnum(' + number + ')" onchange="verifyZffs('+number+')" style="width:90%" value="0.00" oninput="inputnum(this)" /></td><th class="formTitle">支付方式：</th> <td class="formValue" colspan="2"><select id="djjesszffs' + number + '" class="form-control  form-an" style="width:90%"><option value="">==请选择==</option></select></td></tr>');

        $newTr.appendTo($(this).closest('table'));
        binddzffsFloatingSelector(number);
        var djje= ovpraseFloat($("#djje").html()) ;
        var hjssk= ovpraseFloat($('#hjssk').html());
        $("#djjess"+number).val(ovpraseFloat(djje-hjssk).toFixed(2));
        setzfje();
    });

    //是否可添加新支付方式
    function verifyZfje(num)
    {
        var djje= ovpraseFloat($("#djje").html()) ;
        var hjssk= ovpraseFloat($('#hjssk').html());
        if(hjssk>=djje)
        {
            return false;
        }
        return true;
    }

    //删除icon
    $('#tablezf').on('click', '.minusToggleCircle', function (e) {
        debugger;
        var number = $('#tablezf .zffsinput').length;

        var removeTr=$(this).attr('name');
        var lastTr ="i"+$('#tablezf .zffsinput')[number-1].id;
        if(removeTr!=lastTr)
        {
            $.modalAlert('仅支持按最后一种支付方式开始删除', 'error');
            return;
        }
        $(this).closest('tr').remove();
        hjsskZhaolingCalNew();
    })
    //计算输入金额
    function setzfje(){
        hjsskZhaolingCalNew();
    }
    //change
    function verifyZffs(num){
        if ($("#djjesszffs"+num+" option:selected").val() == "" && ovpraseFloat($("#djjess"+num).val()) != 0) {
            $.modalAlert('请选择支付方式', 'error');
        }
    }

    function binddzffsFloatingSelector(num)
    {
        var zfdata = getzfArrayData();
        zfdata.pop();

        $("#djjesszffs"+num).newtouchBindSelect({
            datasource: function () {
                var resultObjArr = new Array();
                $.each(top.clients.SysForCashPayList, function (key, value) {
                    if (value.xjzffs == '3') {
                        return; //不显示该支付方式
                    }
                    var hasSelected = false;
                    for (var i = 0; i < zfdata.length; i ++) {
                        if (value.xjzffs == zfdata[i].zffsmc) {
                            hasSelected = true;
                            break;
                        }
                    }
                    if (!hasSelected) {
                        $('#djjesszffs'+num).append('<option value="' + value.xjzffs + '" selected >' + value.xjzffsmc + '</option>');
                    }
                    else {
                        $('#djjesszffs'+num).append('<option value="' + value.xjzffs + '">' + value.xjzffsmc + '</option>');
                    }
                });
                return resultObjArr;
            }
        });
    }
</script>

